package com.woniu.user.controller;


import com.woniu.entity.PageResult;
import com.woniu.entity.Result;
import com.woniu.user.mapper.CarParamsMapper;
import com.woniu.user.pojo.CarParams;
import com.woniu.user.pojo.dto.SearchCarParamDTO;
import com.woniu.user.service.ICarParamsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 车辆参数表 前端控制器
 *
 * @author LiFangyu
 * @since 2023-02-15
 */
@RestController
@RequestMapping("/car-params")
@Api(tags = "汽车参数控制类")
public class CarParamsController {

    @Autowired
    private ICarParamsService carParamsService;

    @PostMapping("/list/page/{currentPage}/{pageSize}")
    @ApiOperation("搜索并分页展示汽车列表")
    public Result<PageResult<CarParams>> listOrSearchPage(
            @PathVariable Integer currentPage,
            @PathVariable Integer pageSize,
            @RequestBody SearchCarParamDTO searchCarParamDTO){
        PageResult<CarParams> carParamsList = carParamsService.listOrSearchPage(currentPage, pageSize, searchCarParamDTO);
        return Result.ok(carParamsList);
    }
}
